package com.knife.rockknife4jdemo.dto;

import static java.util.Objects.isNull;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

/**.
 * 箱数据
 * @author lht
 */
@Getter
@Setter
@ApiModel("箱子相关数据")
public class ContainerCargoCollectionDTO {

    @ApiModelProperty(value = "ID")
    private Long id;
    @ApiModelProperty(value = "订单类型 NORMAL_BILL:普通订单,HOUSE_BILL:副提单")
    private String blNoType;
    @ApiModelProperty(value = "提单号")
    private String blNo;
    @ApiModelProperty(value = "包装数量")
    private BigDecimal packageQty;
    @ApiModelProperty(value = "货重")
    private BigDecimal weight;
    @ApiModelProperty(value = "体积")
    private BigDecimal volume;

    public String getBlNo() {
        if(StringUtils.isNotBlank(this.blNo)){
            return this.blNo.toUpperCase();
        }
        return blNo;
    }

    public static Boolean validData(ContainerCargoCollectionDTO collection){
        return StringUtils.isBlank(collection.getBlNo())
                   || isNull(collection.getVolume())
                   || isNull(collection.getPackageQty())
                   || isNull(collection.getWeight())
            ;
    }
}